<template>
    <div class="myBox">
        <div class="L"><img :src="LoginUser.avatar_text" /></div>
        <div class="C">
            <div class="tit">{{LoginUser.nickname ? LoginUser.nickname : '未设置昵称'}}</div>
            <div class="sub">{{LoginUser.mobile_text}}</div>
        </div>
        <!-- <div class="R"><img src="/assets/images/go.png" /></div> -->
    </div>
    <div class="clear"></div>
    <div class="allkbox"></div>
    <div class="myboxcon" @click="onProFile">
        <p>基本资料</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon" @click="onEmail">
        <p>邮箱认证</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon" @click="onAddress">
        <p>我的收货地址</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon"  @click="onOrder">
        <p>我的订单</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon" @click="onRecord">
        <p>消费记录</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon">
        <p>充值记录</p>
        <img src="/assets/images/go.png">
    </div>
    <div class="myboxcon"  @click="showPopup">
        <p>注销</p>
        <img src="/assets/images/go.png">
    </div>

    <div class="clear"></div>
    <div class="h54"></div>
    <div class="clear"></div>
    <Tab />
</template>
<script>
import Tab from '@/components/common/Tab.vue'
import {showNotify ,showConfirmDialog, showLoadingToast } from "vant"; 
export default {
    components:{
        Tab
    },
    data() {
        return {
            LoginUser:this.$cookies.get('LoginAuth') ? this.$cookies.get('LoginAuth') : {}
        }
    },
    methods: {
        onProFile()
        {
            this.$router.push('/user/base/profile')
        },
        onAddress()
        {
            this.$router.push('/user/address/index')
        },
        onEmail()
        {
            this.$router.push('/user/base/email')
        },
        onOrder()
        {
            this.$router.push('/user/order/index')
        },
        onRecord(){
               this.$router.push('/user/base/record')
        },
         showPopup() {
      let _this = this;
      this.show = true;

      showConfirmDialog({
        message: "确认退出登录吗",
      }).then(() => {
        showLoadingToast({
          message: "退出登录中",
          onClose: function () {
            console.log(1);
            _this.$cookies.set("LoginAuth", {});
            _this.$router.push("/");
            showNotify({
                  type: "success",
                  message: '退出成功',
                });
          },
        });
      });
    }

    },

}
</script>